//ToStringTest.java
package com.ylaihui.oop8;

class Cup{
	String name;

	// alt + shift + s
	@Override
	public String toString() {
		return "Cup [name=" + name + "]";
	}
}

public class ToStringTest {
	public static void main(String[] args) {
		
		Cup cup = new Cup();
		// 输出一个对象的引用时，实际上就是调用当前对象的toString()
		System.out.println(cup);
		System.out.println(cup.toString());
		
		String s = new String("ylaihui");
		System.out.println(s);
		
	}
}
